package com.clear.observer;

import com.clear.observer.observer.ElectronicScreen;
import com.clear.observer.observer.PhoneApp;
import com.clear.observer.observer.WebsiteDisplay;
import com.clear.observer.subject.WeatherStation;

public class Main {
    public static void main(String[] args) {
        // 定义气象站（主题、被观察者）
        WeatherStation weatherStation = new WeatherStation();
        // 定义观察者，并注册到主题
        PhoneApp phoneApp = new PhoneApp(weatherStation);
        System.out.println("主题与观察者关系建立完成。。。。。");

        // 添加更多观察者  网站上显示-电子大屏
        WebsiteDisplay websiteDisplay = new WebsiteDisplay(weatherStation);
        ElectronicScreen electronicScreen = new ElectronicScreen(weatherStation);


        // 模拟气象站数据更新，会自动通知观察者
        weatherStation.setMeasurements(25, 65, 1010);
        weatherStation.setMeasurements(22, 58, 1005);
    }
}
